﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="community_edit.aspx.cs"
    ValidateRequest="false" Inherits="Com.CMS263.Web.manage.ManageCommunity.community_edit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>

    <script src="/manage/js/jquery-1.4.2.min.js"></script>

    <link href="/manage/css/common.css" rel="stylesheet" type="text/css" />
    <link href="/manage/css/main.css" rel="stylesheet" type="text/css" />
    <link href="/manage/css/box.css" rel="stylesheet" type="text/css" />

    <script>
        function check() {
            var reg = new RegExp("^[0-9]*$");
            var name = $("#txtName").val();
            var order = $("#txtPrice").val();
            var region = $("#selRegion").val();
            var address = $("#address").val();
            if (name.length < 1) {
                alert("请输入名称");
                return false;
            }
            if (region == "0") {
                alert("请选择区域");
                return false;
            }
            if (!reg.test(order) || order.length < 1) {
                alert("均价请输入数字!");
                return false;
            }
            if (address.length < 1) {
                alert("请输入地址!");
                return false;
            }
            return true;
        }
        function changeBankuai() {
            var rid = $("#selRegion").val();
            if (rid != "0") {
                $.post("action.aspx?op=getArea", { rid: rid }, function(data) {
                    $("#selRegionArea").html("");
                    $("#selRegionArea").append('<option value="0">请选择</option>')
                    if (data.length > 1) {
                        var areas = data.split('|');

                        for (var i = 0; i < areas.length; i++) {
                            $("#selRegionArea").append('<option value="' + areas[i] + '">' + areas[i] + '</option>')
                        }
                        $("#selRegionArea").find("option[text='<%=entity.Regionarea %>']").attr("selected", true);
                    }
                })
            }
        }
        $(function() {
            //$("#selRegion").val("<%=entity.Region %>");
            changeBankuai();
            //$("#selRegionArea").val("<%=entity.Regionarea %>");

        })
    </script>

</head>
<body>
    <form id="form1" runat="server" action="" method="post" enctype="multipart/form-data">
    <div class="main">
        <div class="mainMenu">
            <div class="mainMenuList">
                <ul>
                    <li class="s"><a><b>编辑小区</b><span></span></a></li>
                    <li><a href="communitylist.aspx"><b>小区列表</b><span></span></a></li>
                </ul>
            </div>
        </div>
        <div class="mainContent">
            <div class="productSearch">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table1">
                    <tr>
                        <td width="10%" class="c">
                        </td>
                        <td width="10%" class="r">
                            <span style="color: Red">*</span>名称
                        </td>
                        <td width="50%" class="l">
                            <input type="text" id="txtName" name="txtName" value="<%=entity.Name %>" />
                        </td>
                        <td class="c">
                        </td>
                    </tr>
                    <tr>
                        <td class="c">
                        </td>
                        <td class="r">
                            <span style="color: Red">*</span>区域
                        </td>
                        <td class="l">
                            区县：<select id="selRegion" name="selRegion" onchange="changeBankuai()">
                                <option value="0">请选择</option>
                                <% foreach (var item in regionList)
                                   {%>
                                <option value="<%=item.Id %>">
                                    <%=item.Name %></option>
                                <%} %>
                            </select>
                            板块：<select id="selRegionArea" name="selRegionArea"><option value="0">请选择</option>
                            </select>

                            <script>
                                $(function() {
                                    $("#selRegion").find("option[text='<%=entity.Region %>']").attr("selected", true);
                                    changeBankuai();
                                    

                                })
                            </script>

                            <span style="color: Red">没有区域请先<a style="color: blue" href="/manage/ManageRegion/RegionList.aspx ">添加区域</a></span>
                        </td>
                        <td class="c">
                        </td>
                    </tr>
                    <tr>
                        <td class="c">
                        </td>
                        <td class="r">
                            <span style="color: Red">*</span>均价
                        </td>
                        <td class="l">
                            <input type="text" id="txtPrice" name="txtPrice" value="<%=entity.Price %>" /><span
                                style="color: Red">元/平方米</span> 请输入数字
                        </td>
                        <td class="l">
                        </td>
                    </tr>
                    <tr>
                        <td class="c">
                        </td>
                        <td class="r">
                            年代
                        </td>
                        <td class="l">
                            <input type="text" id="txtYear" name="txtYear" value="<%=entity.Year %>" />
                        </td>
                        <td class="c">
                        </td>
                    </tr>
                    <tr>
                        <td class="c">
                        </td>
                        <td class="r">
                            建筑类型
                        </td>
                        <td class="l">
                            <input type="text" id="txtBuild" name="txtBuild" value="<%=entity.Buildtype %>" />
                        </td>
                        <td class="c">
                        </td>
                    </tr>
                    <tr>
                        <td class="c">
                        </td>
                        <td class="r">
                            开发商
                        </td>
                        <td class="l">
                            <input type="text" id="txtDeveloper" name="txtDeveloper" value="<%=entity.Developer %>" />
                        </td>
                        <td class="c">
                        </td>
                    </tr>
                    <tr>
                        <td class="c">
                        </td>
                        <td class="r">
                            <span style="color: Red">*</span>地址
                        </td>
                        <td class="l">
                            <input type="text" id="txtAddress" name="txtAddress" value="<%=entity.Address %>" />
                        </td>
                        <td class="c">
                        </td>
                    </tr>
                    <tr>
                        <td class="c">
                        </td>
                        <td class="r">
                            <span style="color: Red">*</span>封面
                        </td>
                        <td class="l">
                            <input type="file" id="fileCover" name="fileCover" /><br />
                            <img style="width: 200px" src="/artupfile/<%=entity.Cover %>" />
                        </td>
                        <td class="c">
                        </td>
                    </tr>
                    <tr>
                        <td class="c">
                        </td>
                        <td class="r">
                            小区介绍
                        </td>
                        <td class="l">
                            <span style='color: red'>如果是从word文档粘贴的内容,请选择清除或过滤样式</span><br />
                            <input type="hidden" name="intro" id="intro" value="<%=entity.Intro %>" />
                            <iframe id='Iframe1' src='/fckeditor/editor/fckeditor.html?InstanceName=intro&amp;Toolbar=Default'
                                width='100%' height='250px' frameborder='no' scrolling='no'></iframe>
                        </td>
                        <td class="c">
                        </td>
                    </tr>
                    <tr>
                        <td class="c">
                        </td>
                        <td class="r">
                            地图周边
                        </td>
                        <td class="l">
                            <span style='color: red'>如果是从word文档粘贴的内容,请选择清除或过滤样式</span><br />
                            <input type="hidden" name="map" id="map" value="<%=entity.Map %>" />
                            <iframe id='map_Frame' src='/fckeditor/editor/fckeditor.html?InstanceName=map&amp;Toolbar=Default'
                                width='100%' height='250px' frameborder='no' scrolling='no'></iframe>
                        </td>
                        <td class="c">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <div class="con1 productFormBtn cf">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="c">
                        </td>
                        <td class="c">
                            <asp:Button ID="Button1" OnClientClick="return check()" runat="server" Text="保存"
                                OnClick="Button1_Click" />
                                <input type="hidden" name="hdID" value="<%=entity.Id %>" />
                        </td>
                        <td class="c">
                        </td>
                        <td class="c">
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
